package com.example.demo.web;

import io.jsonwebtoken.Claims;
import lombok.extern.log4j.Log4j;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by jinmingjiang on 2017/9/14.
 */
@CrossOrigin
@RestController
@RequestMapping("/api")
@Log4j
public class MainController {

    @GetMapping
    public String index(HttpServletRequest request){
        Claims claims = (Claims) request.getAttribute("claims");
        String subject = claims.getSubject();

        log.info("claims："+claims.toString());

        System.out.println(claims.toString());
        System.out.println(subject.toString());

        return "index....";

    }
}
